#ifndef __LV_PORT_DISP_H
#define __LV_PORT_DISP_H

#include <esp_lcd_panel_io.h>

#define LCD_SHOW_0          0
#define LCD_SHOW_90         0
#define LCD_SHOW_180        1
#define LCD_SHOW_270        0

#if LCD_SHOW_0
    #define LCD_X_PIXELS        320
    #define LCD_Y_PIXELS        480
    #define CONFIG_LV_INVERT_X  1
    #define CONFIG_LV_INVERT_Y  0
    #define CONFIG_LV_SWAPXY    0 
#elif LCD_SHOW_90
    #define LCD_X_PIXELS        480
    #define LCD_Y_PIXELS        320
    #define CONFIG_LV_INVERT_X  0
    #define CONFIG_LV_INVERT_Y  1
    #define CONFIG_LV_SWAPXY    1 
#elif LCD_SHOW_180
    #define LCD_X_PIXELS        320
    #define LCD_Y_PIXELS        480
    #define CONFIG_LV_INVERT_X  0
    #define CONFIG_LV_INVERT_Y  1
    #define CONFIG_LV_SWAPXY    0 
#elif LCD_SHOW_270
    #define LCD_X_PIXELS        480
    #define LCD_Y_PIXELS        320
    #define CONFIG_LV_INVERT_X  1
    #define CONFIG_LV_INVERT_Y  1
    #define CONFIG_LV_SWAPXY    1 
#endif

#define CONFIG_DEFAULT_BACKLIGHT    20    // LCD默认背光亮度百分百

void lv_port_disp_init(void);

void lcd_disp_switch(const esp_lcd_panel_io_handle_t io, bool sw);

void lcd_disp_onoff(bool sw);

esp_err_t lcd_bk_set_brightness(uint8_t brightness);

#endif
